<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<AvansRS.Domain.Group>" %>

<asp:Content ID="Content2" ContentPlaceHolderID="HeadContent" runat="server">
	<link href="../../Content/AutoComplete.css" rel="stylesheet" type="text/css" />
	<script type="text/javascript" src="../../Scripts/jquery-1.3.2.js"></script>
	<script type="text/javascript" src="../../Scripts/jquery.autocomplete.js"></script>
	<script type="text/javascript">
		$(document).ready(function() {
			$("#Member").autocomplete('<%= Url.Action("FindPerson", "Group") %>');
		});
	</script>
</asp:Content>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
	<h2>Edit groepsleden - <%= Html.Encode(Model.Name) %></h2>

    <%= Html.ValidationSummary("Create was unsuccessful. Please correct the errors and try again.") %>

    <% using (Html.BeginForm()) {%>    
        <fieldset>
				<legend>Lid toevoegen:</legend>
				<p>
					<%= Html.Hidden("ID", Model.ID) %>
					<label for="Member">Lid (Gebruikersnaam):</label>
					<%= Html.TextBox("Member") %>
					<%= Html.ValidationMessage("Member", "*") %>
				</p>
        </fieldset>     
        <p>
            <input type="submit" value="Voeg toe" />
        </p>

    <% } %>
		<table>
			<tr>
				<th>Gebruikersnaam</th>
				<th>&nbsp;</th>
			</tr>
		<%
			foreach(var member in Model.Members)
			{
		%>
			<tr>
				<td><%= Html.Encode(member.Account.UserName) %></td>
				<td><%= Html.ActionLink("Verwijder", "DeleteMember", new { groupID = Model.ID, personID = member.ID })%></td>
			</tr>
		<%
			}
		%>			
		</table>	
    <div>
        <%=Html.ActionLink("Back to List", "Index", new { type = Session["type"] })%>
    </div>
</asp:Content>
